cd "/Users/rkreit/Dropbox/Research/MRP Racial Resentment/Perspectives on Politics/Final Files/Replication Files"
log using replicate_resentmentperspectives, replace

/*	************************************************************	*/
/*     	File Name:	Racial Resentment Figures						*/
/*     	Date:   	July 2, 2019									*/
/*      Author: 	Rebecca Kreitzer								*/	
/*      Input File:	resentmentscore_fromR							*/
/*					fips_stateno.dta								*/
/*      Output File:state_resentment.dta							*/
/*		Programs:	grc1leg											*/
/*					estout											*/
/*					maptiles										*/
/*	************************************************************	*/

	 /********************************/
	* Figure 1: National Relative Racial Resentment, 1988-2016			 				
	* note: Note: Aggregate ANES annual racial resentment for all respondents and for White respondents, from 1988-2016.
	/*********************************/

use anes_timeseries_cdf_stata12, clear

tab VCF9039 
	gen raceresent1 = .
	replace raceresent1 = 5 if VCF9039  == 5
	replace raceresent1 = 4 if VCF9039  == 4
	replace raceresent1 = 3 if VCF9039  == 3	
	replace raceresent1 = 2 if VCF9039  == 2	
	replace raceresent1 = 1 if VCF9039  == 1
	
tab VCF9040
	gen raceresent2 = .
	replace raceresent2 = 5 if VCF9040  == 1
	replace raceresent2 = 4 if VCF9040  == 2
	replace raceresent2 = 3 if VCF9040  == 3	
	replace raceresent2 = 2 if VCF9040  == 4	
	replace raceresent2 = 1 if VCF9040  == 5
	
tab VCF9041
	gen raceresent3 = .
	replace raceresent3 = 5 if VCF9040  == 1
	replace raceresent3 = 4 if VCF9040  == 2
	replace raceresent3 = 3 if VCF9040  == 3	
	replace raceresent3 = 2 if VCF9040  == 4	
	replace raceresent3 = 1 if VCF9040  == 5
	
tab VCF9042
	gen raceresent4 = .
	replace raceresent4 = 5 if VCF9042  == 5
	replace raceresent4 = 4 if VCF9042  == 4
	replace raceresent4 = 3 if VCF9042  == 3	
	replace raceresent4 = 2 if VCF9042  == 2	
	replace raceresent4 = 1 if VCF9042  == 1

gen resentraw = raceresent1 + raceresent2 + raceresent3 + raceresent4
gen resentrs = resentraw / 20	
	
tab VCF0004
	gen year = .
	replace year = VCF0004 if VCF0004 > 1986

tab VCF0106
	gen white = .
	replace white = 1 if VCF0106 == 1

* get the avg score for each year for all races and for whites
* these values are recorded in a few file, anes_collapsed
sum resentrs if year == 1988 	
sum resentrs if year == 1988 & white == 1
sum resentrs if year == 1990 	
sum resentrs if year == 1990 & white == 1	
sum resentrs if year == 1992 	
sum resentrs if year == 1992 & white == 1
sum resentrs if year == 1994 	
sum resentrs if year == 1994 & white == 1
sum resentrs if year == 1996 	
sum resentrs if year == 1996 & white == 1
sum resentrs if year == 1998 	
sum resentrs if year == 1998 & white == 1	
sum resentrs if year == 2000 	
sum resentrs if year == 2000 & white == 1	
sum resentrs if year == 2002 	
sum resentrs if year == 2002 & white == 1
sum resentrs if year == 2004 	
sum resentrs if year == 2004 & white == 1	
sum resentrs if year == 2008 	
sum resentrs if year == 2008 & white == 1
sum resentrs if year == 2012 	
sum resentrs if year == 2012 & white == 1


use anes_collapsed, clear

twoway line resentall year, lcolor(gs5) lpattern(solid) legend(label(1 "All People")) ///
	|| line resentwhite year, lcolor(gs13) lpattern(longdashed) legend(label(2 "Whites Only")) ///
	xtitle("Year", size(medium)) ylabel(0(.1)1) graphregion(color(white)) 



	
clear
import excel final_result_long, firstrow
	merge m:1 state_abbrev using fips_stateno.dta
	rename fips statefips
	drop _merge
	save state_resentment.dta, replace

* rescale the resentment score for ease of interpretation and some other necessary coding

	label var resent_score "Racial Resentment"	
	
gen resent1988 = resent_score if year == 1988
gen resent1990 = resent_score if year == 1990
gen resent1992 = resent_score if year == 1992
gen resent1994 = resent_score if year == 1994
gen resent2000 = resent_score if year == 2000
gen resent2004 = resent_score if year == 2004
gen resent2008 = resent_score if year == 2008
gen resent2012 = resent_score if year == 2012
gen resent2016 = resent_score if year == 2016



	
	/*********************************/
	* Figure 2: Figure 2. Sample of 8 States’ Racial Resentment, 1988-2016
	* note: This selection of states represents a range of state trend lines, including some of the states with the highest and lowest racial 
	* resentment. Note, however, that the relative ordering of these states is not constant, and the state trends follow different trajectories. 
	/*********************************/	
	
sort stateno1 year
	
twoway line resent_score year if state_abbrev=="AZ"  ,  lcolor(gs12) lpattern(longdash) legend(label(1 "Arizona")) ///
	|| line resent_score year if state_abbrev=="UT"  ,  lcolor(gs11) lpattern(longdash_dot) legend(label(2 "Utah")) ///
	|| line resent_score year if state_abbrev=="HI"  ,  lcolor(gs10) lpattern(shortdash) legend(label(3 "Hawaii")) ///
	|| line resent_score year if state_abbrev=="WV"  ,  lcolor(gs9) lpattern(dash) legend(label(4 "West Virginia")) ///
	|| line resent_score year if state_abbrev=="CA"  ,  lcolor(gs8) lpattern(solid) legend(label(5 "California")) ///	
	|| line resent_score year if state_abbrev=="VT"  ,  lcolor(gs6) lpattern(shortdash_dot) legend(label(6 "Vermont")) ///	
	|| line resent_score year if state_abbrev=="RI"  ,  lcolor(gs4) lpattern(longdash) legend(label(7 "Rhode Island")) ///
	|| line resent_score year if state_abbrev=="MS"  ,  lcolor(gs2) lpattern(solid) legend(label(8 "Mississippi")) ///
	xtitle("Year", size(medium)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white))	
	
	/*********************************/
	* Figure 3: Figure 3. Annual Relative Racial Resentment in the States, 1988-2016
	* note: Quintiles for each map are calculated using data from that year only. As such, the individual maps should not be directly compared 
	* to each other. However, it is appropriate to compare to maps to observe patterns in which states have racial resentment scores in the 
	* higher and low quintiles of the data.
	/*********************************/

	* generate quintiles for maps for each year
xtile yearquintile88=resent1988, n(5)
xtile yearquintile90=resent1990, n(5)
xtile yearquintile92=resent1992, n(5)
xtile yearquintile94=resent1994, n(5)
xtile yearquintile00=resent2000, n(5)
xtile yearquintile04=resent2004, n(5)
xtile yearquintile08=resent2008, n(5)
xtile yearquintile12=resent2012, n(5)
xtile yearquintile16=resent2016, n(5)

*quintile maps by year
 maptile yearquintile88 if year == 1988, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1988")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("1988qbw") replace
	
 maptile yearquintile90 if year == 1990, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1990")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("1990qbw") replace
	
 maptile yearquintile92 if year == 1992, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1992")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("1992qbw") replace
	
 maptile yearquintile94 if year == 1994, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1994")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("1994qbw") replace 	
	
 maptile yearquintile00 if year == 2000, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2000")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("2000qbw") replace
		
 maptile yearquintile04 if year == 2004, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2004")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("2004qbw") replace
			
 maptile yearquintile08 if year == 2008, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2008")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("2008qbw") replace		
		
 maptile yearquintile12 if year == 2012, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2012")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("2012qbw") replace 		

 maptile yearquintile16 if year == 2016, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2016") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("2016qbw") replace 

* create the map for figure 3
graph combine 1988qbw.gph 1990qbw.gph 1992qbw.gph 1994qbw.gph 2000qbw.gph 2004qbw.gph 2008qbw.gph 2012qbw.gph 2016qbw.gph, scheme(s1color)  
	
	/*********************************/
	* Figure 4: Figure 4. Changes in Estimated Racial Resentment Over Time	
	* note: This figure shows the estimated racial resentment in each state, in each year of the data. The states are sorted vertically by racial 
	* resentment scores in 1988. States at the top of the figure have low racial resentment.
	/*********************************/

graph dot resent1988 resent1990 resent1992 resent1994 resent2000 resent2004 ///
	resent2008 resent2012 resent2016, over(state_abbrev, sort(resent2016) label(labsize(vsmall))) nofill ndots(60) ///
	marker(1, mcolor(black) msymbol(circle_hollow) msize(small)) ///
	marker(2, mcolor(gs2) msymbol(plus) msize(small)) ///
	marker(3, mcolor(gs4) msymbol(diamond_hollow) msize(small))  /// 
	marker(4, mcolor(gs6) msymbol(triangle_hollow) msize(small))  /// 
	marker(5, mcolor(gs8) msymbol(square_hollow) msize(small))  /// 
	marker(6, mcolor(gs9) msymbol(circle) msize(small))  /// 
	marker(7, mcolor(gs10) msymbol(diamond) msize(small))  /// 
	marker(8, mcolor(gs11) msymbol(triangle) msize(small))  /// 
	marker(9, mcolor(gs12) msymbol(square) msize(small))  /// 
	graphregion(margin(medsmall)) legend(row(1) label(1 "1988") label(2 "1990") label(3 "1992") ///
	label(4 "1994") label(5 "2000") label(6 "2004") label(7 "2008") label(8 "2012") label(9 "2016")) ///
	ylabel(#25, labsize(small))  graphregion(color(white))
	
	/*********************************/
	* Figure 5: Mapping Changes in Racial Resentment in the States Over Time, 1988-2016	
	* note: Quintiles for each map are calculated using data all years pooled. Each state in each year represents a separate observation in the data.  
	* As such, one can compare the level of racial resentment in the states across map years.
	/*********************************/
	
xtile quintile=resent_score, n(5)

 maptile quintile if year == 1988, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1988")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t1988qbw") replace
	
 maptile quintile if year == 1990, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1990")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t1990qbw") replace
	
 maptile quintile if year == 1992, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1992")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t1992qbw") replace
	
 maptile quintile if year == 1994, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("1994")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t1994qbw") replace
	
 maptile quintile if year == 2000, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2000")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t2000qbw") replace
	
 maptile quintile if year == 2004, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2004")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t2004qbw") replace
			
 maptile quintile if year == 2008, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2008")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t2008qbw") replace
	
 maptile quintile if year == 2012, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2012")legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t2012qbw") replace

 maptile quintile if year == 2016, geo(state) geoid(statefips) cutvalue(1 2 3 4) fcolor(Greys) ///
	legd(0) twopt(title("2016") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5"))) ///
	savegraph("t2016qbw") replace
	
graph combine t1988qbw.gph t1990qbw.gph t1992qbw.gph t1994qbw.gph t2000qbw.gph t2004qbw.gph t2008qbw.gph t2012qbw.gph t2016qbw.gph, scheme(s1color) 

	////////////////////////////////////////////////////////////////////////////
	
	/*********************************/
	* Figure A1: Racial Resentment in Individual States, Over Time	
	/*********************************/
	
twoway line resent_score year if state_abbrev=="AL" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Alabama", size(huge)) name(al, replace) 
twoway line resent_score year if state_abbrev=="AK" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///   
	ylabel(, labsize(large)) title("Alaska", size(huge)) name(ak, replace)   	
twoway line resent_score year if state_abbrev=="AZ" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Arizona", size(huge)) name(az, replace)  
twoway line resent_score year if state_abbrev=="AR" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Arkansas", size(huge)) name(ar, replace)   
twoway line resent_score year if state_abbrev=="CA" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("California", size(huge)) name(ca, replace)  
twoway line resent_score year if state_abbrev=="CO" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Colorado", size(huge)) name(co, replace) 
twoway line resent_score year if state_abbrev=="CT" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Connecticut", size(huge)) name(ct, replace)   	
twoway line resent_score year if state_abbrev=="DE" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Delaware", size(huge)) name(de, replace)   
twoway line resent_score year if state_abbrev=="FL" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Florida", size(huge)) name(fl, replace)   
twoway line resent_score year if state_abbrev=="GA" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Georgia", size(huge)) name(ga, replace)   

twoway line resent_score year if state_abbrev=="HI"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Hawaii", size(huge)) name(hi, replace)   
twoway line resent_score year if state_abbrev=="ID"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Idaho", size(huge)) name(id, replace)  	
twoway line resent_score year if state_abbrev=="IL" , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Illinois", size(huge)) name(il, replace)  
twoway line resent_score year if state_abbrev=="IN"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///   
	ylabel(, labsize(large)) title("Indiana", size(huge)) name(ind, replace)  
twoway line resent_score year if state_abbrev=="IA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///   
	ylabel(, labsize(large)) title("Iowa", size(huge)) name(ia, replace) 	
twoway line resent_score year if state_abbrev=="KS"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Kansas", size(huge)) name(ks, replace)  
twoway line resent_score year if state_abbrev=="KY"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Kentucky", size(huge)) name(ky, replace)   
twoway line resent_score year if state_abbrev=="LA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Louisiana", size(huge)) name(la, replace)  
twoway line resent_score year if state_abbrev=="ME"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Maine", size(huge)) name(me, replace)   	
twoway line resent_score year if state_abbrev=="MD"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Maryland", size(huge)) name(md, replace)   
	
twoway line resent_score year if state_abbrev=="MA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Massachusetts", size(huge)) name(ma, replace)   
twoway line resent_score year if state_abbrev=="MI"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Michigan", size(huge)) name(mi, replace)   		
twoway line resent_score year if state_abbrev=="MN"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Minnesota", size(huge)) name(mn, replace)   
twoway line resent_score year if state_abbrev=="MS"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Mississippi", size(huge)) name(ms, replace)   	
twoway line resent_score year if state_abbrev=="MO"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// / 
	ylabel(, labsize(large)) title("Missouri", size(huge)) name(mo, replace)  
twoway line resent_score year if state_abbrev=="MT"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Montana", size(huge)) name(mt, replace)   
twoway line resent_score year if state_abbrev=="NE"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Nebraska", size(huge)) name(ne, replace)   	
twoway line resent_score year if state_abbrev=="NV"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Nevada", size(huge)) name(nv, replace) 
twoway line resent_score year if state_abbrev=="NH"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("New Hampshire", size(huge)) name(nh, replace)  
twoway line resent_score year if state_abbrev=="NJ"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("New Jersey", size(huge)) name(nj, replace)   
	
twoway line resent_score year if state_abbrev=="NM"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("New Mexico", size(huge)) name(nm, replace)   
twoway line resent_score year if state_abbrev=="NY"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("New York", size(huge)) name(ny, replace)  
twoway line resent_score year if state_abbrev=="NC"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("North Carolina", size(huge)) name(nc, replace)   	
twoway line resent_score year if state_abbrev=="ND"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("North Dakota", size(huge)) name(nd, replace)   
twoway line resent_score year if state_abbrev=="OH"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Ohio", size(huge)) name(oh, replace)   
twoway line resent_score year if state_abbrev=="OK"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Oklahoma", size(huge))name(ok, replace) 
twoway line resent_score year if state_abbrev=="OR"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Oregon", size(huge)) name(or, replace)  
twoway line resent_score year if state_abbrev=="PA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Pennsylvania", size(huge)) name(pa, replace)  	
twoway line resent_score year if state_abbrev=="RI"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Rhode Island", size(huge)) name(ri, replace)  
twoway line resent_score year if state_abbrev=="SC"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("South Carolina", size(huge)) name(sc, replace)  

twoway line resent_score year if state_abbrev=="SD"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("South Dakota", size(huge)) name(sd, replace)  
twoway line resent_score year if state_abbrev=="TN"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Tennessee", size(huge)) name(tn, replace)  	
twoway line resent_score year if state_abbrev=="TX"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Texas", size(huge)) name(tx, replace)  
twoway line resent_score year if state_abbrev=="UT"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Utah", size(huge)) name(ut, replace) 
twoway line resent_score year if state_abbrev=="VT"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Vermont", size(huge)) name(vt, replace) 		
twoway line resent_score year if state_abbrev=="VA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Virginia", size(huge)) name(va, replace)  
twoway line resent_score year if state_abbrev=="WA"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Washington", size(huge)) name(wa, replace) 	
twoway line resent_score year if state_abbrev=="WV"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("West Virginia", size(huge)) name(wv, replace)  
twoway line resent_score year if state_abbrev=="WI"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) ///  
	ylabel(, labsize(large)) title("Wisconsin", size(huge)) name(wi, replace) 
twoway line resent_score year if state_abbrev=="WY"  , lwidth(thick) lcolor(ebblue) legend(label(1 "State RR")) ///
	xtitle("Year", size(vlarge)) ylabel(0(.1)1) lpattern(solid) graphregion(color(white)) /// 
	ylabel(, labsize(large)) title("Wyoming", size(huge))name(wy, replace)  	
		
grc1leg al ak az ar ca co ct de fl ga hi id il ind ia ks ky la me md ma mi mn ms mo, col(5) iscale(1) altshrink xcom ycom  ///
	title("Racial Resentment in the States, Part 1") note("Common scale for all states") graphregion(color(white)) 

grc1leg mt ne nv nh nj nm ny nc nd oh ok or pa ri sc sd tn tx ut vt va wa wv wi wy, col(5) iscale(1) altshrink xcom ycom  ///
	title("Racial Resentment in the States, Part 2") note("Common scale for all states") graphregion(color(white)) 
	
	
	/*********************************/
	* Figure A3: Mapping Annual Racial Resentment in the States, Relative to Other States
	* note: This is similar to Figure 3, but with deciles in lieu of quintiles. Quintiles for each map are calculated using data from that year only. 
	* As such, the individual maps should not be directly compared to each other. However, it is appropriate to compare to maps to observe patterns in 
	* which states have racial resentment scores in the higher and low quintiles of the data.
	/*********************************/
	
	* generate deciles for maps for each year
xtile yeardecile88=resent1988, n(10)
xtile yeardecile90=resent1990, n(10)
xtile yeardecile92=resent1992, n(10)
xtile yeardecile94=resent1994, n(10)
xtile yeardecile00=resent2000, n(10)
xtile yeardecile04=resent2004, n(10)
xtile yeardecile08=resent2008, n(10)
xtile yeardecile12=resent2012, n(10)
xtile yeardecile16=resent2016, n(10)

maptile yeardecile88 if year == 1988, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1988") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("1988dbw") replace
	
 maptile yeardecile90 if year == 1990, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1990") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("1990dbw")  replace	
	
 maptile yeardecile92 if year == 1992, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1992") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("1992dbw") replace 
	
 maptile yeardecile94 if year == 1994, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1994") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("1994dbw") replace 
	
 maptile yeardecile00 if year == 2000, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2000") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("2000dbw")  replace	

 maptile yeardecile04 if year == 2004, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2004") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("2004dbw") replace
	
maptile yeardecile08 if year == 2008, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2008") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("2008dbw")  replace
	
 maptile yeardecile12 if year == 2012, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2012") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("2012dbw")  replace

 maptile yeardecile16 if year == 2016, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2016") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("2016dbw")  replace

* create the map for figure A3
graph combine 1988dbw.gph 1990dbw.gph 1992dbw.gph 1994dbw.gph 2000dbw.gph 2004dbw.gph 2008dbw.gph 2012dbw.gph 2016dbw.gph, scheme(s1color) ///
	rows(3) cols(3) ///
	imargin(tiny) ///
	xsize(6) ysize(4) 
	
	/*********************************/
	* Figure A4: Changes in Estimated Racial Resentment in Over Time, Sort by Racial Resentment in 2016
	* note: This is similar to Figure 4, but instead sorted by estimated racial resentment in 2016.
	/*********************************/
	
	graph dot resent1988 resent1990 resent1992 resent1994 resent2000 resent2004 ///
	resent2008 resent2012 resent2016, over(state_abbrev, sort(resent2016) label(labsize(vsmall))) nofill ndots(60) ///
	marker(1, mcolor(black) msymbol(circle_hollow) msize(small)) ///
	marker(2, mcolor(gs2) msymbol(plus) msize(small)) ///
	marker(3, mcolor(gs4) msymbol(diamond_hollow) msize(small))  /// 
	marker(4, mcolor(gs6) msymbol(triangle_hollow) msize(small))  /// 
	marker(5, mcolor(gs8) msymbol(square_hollow) msize(small))  /// 
	marker(6, mcolor(gs9) msymbol(circle) msize(small))  /// 
	marker(7, mcolor(gs10) msymbol(diamond) msize(small))  /// 
	marker(8, mcolor(gs11) msymbol(triangle) msize(small))  /// 
	marker(9, mcolor(gs12) msymbol(square) msize(small))  /// 
	graphregion(margin(medsmall)) legend(row(1) label(1 "1988") label(2 "1990") label(3 "1992") ///
	label(4 "1994") label(5 "2000") label(6 "2004") label(7 "2008") label(8 "2012") label(9 "2016")) ///
	ylabel(#25, labsize(small))  graphregion(color(white))
	
	/*********************************/
	* Figure A5: Mapping Annual Racial Resentment in the States, Relative to Other States
	* note: TThis is similar to Figure 5, but with deciles in lieu of quintiles. Quintiles for each map are calculated using data from that year only. 
	* As such, the individual maps should not be directly compared to each other. However, it is appropriate to compare to maps to observe patterns in 
	* which states have racial resentment scores in the higher and low quintiles of the data.
	/*********************************/
	
xtile decile=resent_score, n(10)	
	
maptile decile if year == 1988, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1988") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t1988dbw") replace		
	
 maptile decile if year == 1990, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1990") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t1990dbw") replace 
	
 maptile decile if year == 1992, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1992") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t1992dbw") replace

 maptile decile if year == 1994, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("1994") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t1994dbw") replace	
	
 maptile decile if year == 2000, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2000") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t2000dbw") replace		

 maptile decile if year == 2004, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2004") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t2004dbw") replace
	
maptile decile if year == 2008, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2008") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t2008dbw") replace

 maptile decile if year == 2012, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2012") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t2012dbw") replace
	
 maptile decile if year == 2016, geo(state) geoid(statefips) cutvalue(1 2 3 4 5 6 7 8 9) ///
	fcolor(gs14 gs13 gs12 gs11 gs9 gs7 gs6 gs5 gs4 gs3) ///
	legd(0) twopt(title("2016") legend(lab(2 "1") lab(3 "2") lab(4 "3") lab(5 "4") lab(6 "5") lab(7 "6") ///
	lab(8 "7") lab(9 "8") lab(10 "9") lab(11 "10"))) ///
	savegraph("t2016dbw") replace

graph combine t1988dbw.gph t1990dbw.gph t1992dbw.gph t1994dbw.gph t2000dbw.gph t2004dbw.gph t2008dbw.gph t2012dbw.gph t2016dbw.gph, scheme(s1color) ///
	rows(3) cols(3) ///
	imargin(tiny) ///
	xsize(6) ysize(4) 

	/*********************************/
	* Figure A2: Racial Resentment by Region, Over Time	
	* note: This is similar to Figure 2, but shows the four regions as determined by the US Census.
	/*********************************/
	
* Generate regional variable
gen region = .
label define region 1 "Northeast" 2 "West" 3 "Midwest" 4 "South"
*1= NE, 3 = MW, 2 = W, 4 = S
	 replace region = 3 if state_abbrev == "IA"
	 replace region = 3 if state_abbrev == "IL"
	 replace region = 3 if state_abbrev == "IN"
	 replace region = 3 if state_abbrev == "KS"
	 replace region = 3 if state_abbrev == "MI"
	 replace region = 3 if state_abbrev == "MN"
	 replace region = 3 if state_abbrev == "MO"
	 replace region = 3 if state_abbrev == "ND"
	 replace region = 3 if state_abbrev == "NE"
	 replace region = 3 if state_abbrev == "OH"
	 replace region = 3 if state_abbrev == "SD"
	 replace region = 3 if state_abbrev == "WI"

	 replace region = 1 if state_abbrev == "CT"
	 replace region = 1 if state_abbrev == "MA"
	 replace region = 1 if state_abbrev == "ME"
	 replace region = 1 if state_abbrev == "NH"
	 replace region = 1 if state_abbrev == "NJ"
	 replace region = 1 if state_abbrev == "NY"
	 replace region = 1 if state_abbrev == "PA"
	 replace region = 1 if state_abbrev == "RI"
	 replace region = 1 if state_abbrev == "VT"

	 replace region = 4 if state_abbrev == "AL"
	 replace region = 4 if state_abbrev == "AR"
	 replace region = 4 if state_abbrev == "DE"
	 replace region = 4 if state_abbrev == "FL"
	 replace region = 4 if state_abbrev == "GA"
	 replace region = 4 if state_abbrev == "KY"
	 replace region = 4 if state_abbrev == "LA"
	 replace region = 4 if state_abbrev == "MD"
	 replace region = 4 if state_abbrev == "MS"
	 replace region = 4 if state_abbrev == "NC"
	 replace region = 4 if state_abbrev == "OK"
	 replace region = 4 if state_abbrev == "SC"
	 replace region = 4 if state_abbrev == "TN"
	 replace region = 4 if state_abbrev == "TX"
	 replace region = 4 if state_abbrev == "VA"
	 replace region = 4 if state_abbrev == "WV"

	 replace region = 2 if state_abbrev == "AK"
	 replace region = 2 if state_abbrev == "AZ"
	 replace region = 2 if state_abbrev == "CA"
	 replace region = 2 if state_abbrev == "CO"
	 replace region = 2 if state_abbrev == "HI"
	 replace region = 2 if state_abbrev == "ID"
	 replace region = 2 if state_abbrev == "MT"
	 replace region = 2 if state_abbrev == "NM"
	 replace region = 2 if state_abbrev == "NV"
	 replace region = 2 if state_abbrev == "OR"
	 replace region = 2 if state_abbrev == "UT"
	 replace region = 2 if state_abbrev == "WA"
	 replace region = 2 if state_abbrev == "WY"
	
	collapse resent_score, by(region year)

	graph twoway line resent_score year if region == 1, lcolor(gs0) lpattern(solid) || ///
	 line resent_score year if region == 2, lcolor(gs3) lpattern(shortdash) || ///
	 line resent_score year if region == 3,lcolor(gs0) lpattern(longdash)  || ///
	 line resent_score year if region == 4, lcolor(gs2) lpattern(dash_dot) ///
	 graphregion(color(white)) ytitle(Racial Resentment by Region) ylabel(0(.1)1) ///
	 legend(label(1 "Northeast") label(2 "West") label(3 "Midwest") label(4 "South")) 
 
	
log close

